package src.phase.one.gui;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.KeyStroke;

public class MenuBar {
	
	private static JMenuBar menuBar;
	private static JMenu menu;
	private static JMenu Submenu;
	private static JMenuItem menuItem;
	private static JRadioButtonMenuItem rbMenuItem;
	private static JCheckBoxMenuItem cbMenuItem;
	
	
	public static JMenuBar getMenuBar(){
		
		menuBar = new JMenuBar();
		menu = new JMenu("File");
		menu.setMnemonic(KeyEvent.VK_A);
		menu.getAccessibleContext().setAccessibleDescription("Zusätzlich mit Icon für das Menü");	        
		menuBar.add(menu);
	
		//----------------------------------------------
		
		menuItem = new JMenuItem("New Document", KeyEvent.VK_T);		                        
		menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK));	        
		menuItem.getAccessibleContext().setAccessibleDescription("tut erstmal noch nichts");
		menuItem.addActionListener(new Listener());        
		menu.add(menuItem);		
			
		menuItem = new JMenuItem("open file", new ImageIcon("Images/Henrytest.gif"));
		menuItem.setMnemonic(KeyEvent.VK_B);
		menuItem.addActionListener(new Listener());                         	
		menu.add(menuItem);
		
		menuItem = new JMenuItem("save file", new ImageIcon("Images/Henrytest.gif"));
		menuItem.setMnemonic(KeyEvent.VK_B);
		menuItem.addActionListener(new Listener());                         	
		menu.add(menuItem);
		
	
		
		menu.addSeparator();
		//----------------------------------------------
		
		menuItem = new JMenuItem("print", new ImageIcon("Images/Henrytest.gif"));
		menuItem.setMnemonic(KeyEvent.VK_B);
		menuItem.addActionListener(new Listener());                         	
		menu.add(menuItem);
		
		
		Submenu = new JMenu("utilities");
		Submenu.setMnemonic(KeyEvent.VK_S);

		menuItem = new JMenuItem("send email");
		menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK));
		menuItem.addActionListener(new Listener());
		Submenu.add(menuItem);

		menuItem = new JMenuItem("create flyer");
		menuItem.addActionListener(new Listener());
		Submenu.add(menuItem);
		
		menuItem = new JMenuItem("export as XML");
		menuItem.addActionListener(new Listener());
		Submenu.add(menuItem);		
		
		
		menu.add(Submenu);
		
		
		menu.addSeparator();
		
		
		
		
		//----------------------------------------------
		
				
		//Eine Gruppe von RadioButtons
		/*
		ButtonGroup group = new ButtonGroup();
		rbMenuItem = new JRadioButtonMenuItem("Hilfe einblenden");
		rbMenuItem.setSelected(true);
		rbMenuItem.setMnemonic(KeyEvent.VK_R);
		group.add(rbMenuItem);
		menu.add(rbMenuItem);

		rbMenuItem = new JRadioButtonMenuItem("Hilfe ausblenden");
		rbMenuItem.setMnemonic(KeyEvent.VK_O);
		group.add(rbMenuItem);
		menu.add(rbMenuItem);

		//Eine paar Checkbox-Items
		menu.addSeparator();
		cbMenuItem = new JCheckBoxMenuItem("Beispielmenü");
		cbMenuItem.setMnemonic(KeyEvent.VK_C);
		menu.add(cbMenuItem);

		cbMenuItem = new JCheckBoxMenuItem("Beispielmenü");
		cbMenuItem.setMnemonic(KeyEvent.VK_H);
		menu.add(cbMenuItem);
		*/
			
		//Ein Item zum Beenden
		menuItem = new JMenuItem("Exit");
               
        menuItem.setMnemonic(KeyEvent.VK_B);
        menu.add(menuItem);
        menuItem = new JMenuItem(new ImageIcon("bilder/Henrytest2.gif"));
        menuItem.setMnemonic(KeyEvent.VK_D);
        menuItem.addActionListener(new Listener());
        menu.add(menuItem);
		
		
		

      //----------------------------------------------

		//Build second menu in the menu bar.
		menu = new JMenu("Edit");
		menu.setMnemonic(KeyEvent.VK_N);
		menu.getAccessibleContext().setAccessibleDescription("Tut erstmal noch nichts");
		
		menuItem = new JMenuItem("analyse");       
        menuItem.setMnemonic(KeyEvent.VK_B);
        menuItem.addActionListener(new Listener());
        menu.add(menuItem);
        
    	
		
        
       
        menu.addSeparator();
      //----------------------------------------------
        
        
		ButtonGroup group = new ButtonGroup();
		rbMenuItem = new JRadioButtonMenuItem("deutsch");
		rbMenuItem.setSelected(true);
		rbMenuItem.setMnemonic(KeyEvent.VK_R);
		rbMenuItem.setText(rbMenuItem.getText());
		group.add(rbMenuItem);
		
		menu.add(rbMenuItem);

		rbMenuItem = new JRadioButtonMenuItem("englisch");
		rbMenuItem.setMnemonic(KeyEvent.VK_O);
		rbMenuItem.setText(rbMenuItem.getText());
		group.add(rbMenuItem);
		menu.add(rbMenuItem);
		
		
		
		        
		menuBar.add(menu);
		

		
		
		
		return menuBar;
		
	}

}
